<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class News extends My_Controller {

    function __construct() {
        parent::__construct();
        $this->load->model('News_model', 'news');
        $this->config->load('osc_config', TRUE);
    }

    public function index() {

        $this->navigation->loadNewsLatestView();
    }

    public function latest() {
        $news_per_page = $this->config->item('news_per_page', 'osc_config');
        $data['queryNewsLatestList'] = $this->news->loadNewsLatestList($news_per_page);
        $this->navigation->loadNewsLatestView($data);
    }

    public function item() {
       $id= (int) $this->uri->segment(3);
        if((int)$id > 0){
            $data['queryNewsItemInfo'] = $this->news->loadNewsItemInfo($id);
        }
        $this->navigation->loadNewsItemView($data);
    }

}
